package hngc.com;
import java.util.Scanner;

public class Box1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int x = 0;
        int k = 0;
        System.out.println("请输入x的值:");
        while (scanner.hasNext()) {
            try {
                x = scanner.nextInt();
                System.out.println("输入k的值:");
                k = scanner.nextInt();
                break;
            } catch (Exception e) {
                System.out.println("输入不符合要求");
                return;
            }
        }
        if (x > 0 && x < 10) {
            System.out.println("测试为算式一，值为：" + Math.log(x * k));
        } else if (x >= 10 && x < 20) {
            System.out.println("测试为算式二，值为：" + Math.pow(x, k));
        } else if (x >= 20 && x < 30) {
            System.out.println("测试为算式三，值为：" + Math.pow(x, 1d / k));
            //1d即为1.0
        } else if (x < 0 || k < 0) {
            System.out.println("输入不符合要求");
        } else {
            System.out.println("数据超过范围");
        }
        scanner.close();
    }
}
